xend: fix leak of /local/domain/* in xenstore
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 7 Apr 2009 09:14:35 +0000 (10:14 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 7 Apr 2009 09:14:35 +0000 (10:14 +0100)
xenwatch thread _storeChanged() may create /local/domain/<domid>
entries in xenstore even after the domain has shutdown.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
tools/python/xen/xend/XendDomainInfo.py

index 644831b87db8c539694c99146f92d008d2152858..17ed7dac11a9aadc7f566e4c1c4f710e3c037add 100644 (file)
@@ -1634,7 +1634,13 @@ class XendDomainInfo:
         if changed:
             # Update the domain section of the store, as this contains some
             # parameters derived from the VM configuration.
-            self._storeDomDetails()
+            self.refresh_shutdown_lock.acquire()
+            try:
+                state = self._stateGet()
+                if state not in (DOM_STATE_SHUTDOWN, DOM_STATE_HALTED,):
+                    self._storeDomDetails()
+            finally:
+                self.refresh_shutdown_lock.release()
 
         return 1